﻿using System;
using System.Collections.Generic;
using System.Text;

namespace MobileManagement.Library
{
    public class Mobile
    {
        private string _MobileId;
        private DateTime _LastUpdate;
        private TimeSpan _Diff;
        private int _Threshold;

        public bool IsActive
        {
            get
            {
                return _Diff.Hours > _Threshold;
            }
        }

        public Mobile(string mobileId, DateTime lastUpdate, int threshold = 2)
        {
            _MobileId = mobileId;
            _LastUpdate = lastUpdate;
            _Diff = DateTime.Now - lastUpdate;
            _Threshold = threshold;
        }

        public override string ToString()
        {
            return "Mobile Id "+ _MobileId + " - Diff is -> " +_Diff.Hours.ToString().PadLeft(2, '0') + ":" + _Diff.Minutes.ToString().PadLeft(2, '0') + ":" + _Diff.Seconds.ToString().PadLeft(2, '0');
        }


    }
}
